package com.example.demo122.demos;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class Test {

    @Value("${bite}")
    private String str;
    @RequestMapping("/str")
    public String getStr(){
        return str;
    }

    @Value("dddd")//直接赋值：将"dddd"赋值给a
    private String a;

    @Value("${bite}")
    String s;
    @RequestMapping("/t")
    public String hello(){
        return s;
    }

    @Autowired
    private Student student;
    @RequestMapping("/tt")
    public String read(){
        return student.toString();
    }

    @Autowired
    private Friend friend;
    @RequestMapping("/ttt")
    String red(){
        System.out.println(friend.getName().size()+friend.getMap().size());
        return friend.toString();
    }
}
